package com.kmproject.haifu.mvp.ui.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.http.imageloader.glide.ImageConfigImpl;
import com.jess.arms.utils.ArmsUtils;
import com.kmproject.haifu.R;
import com.kmproject.haifu.mvp.model.entity.beans.HouseRentListShowBean;

import java.util.List;

public class HouseRentingShowFwpzAdapter extends BaseQuickAdapter<HouseRentListShowBean.DetailsBean,BaseViewHolder> {
    ImageLoader glideImage;
    public HouseRentingShowFwpzAdapter( @Nullable List<HouseRentListShowBean.DetailsBean> data) {
        super(R.layout.houserentshow_fwpz_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, HouseRentListShowBean.DetailsBean item) {
        if (glideImage == null) {
            glideImage = ArmsUtils.obtainAppComponentFromContext(mContext).imageLoader();
        }
    helper.<TextView>getView(R.id.houserentshow_fwpz_item_txt).setText(item.getBaseDictName());
    if (item.getIcon()!=null&&!TextUtils.isEmpty(item.getIcon()))
    {
        glideImage.loadImage(mContext, ImageConfigImpl.builder().url(item.getIcon())
                .imageView(helper.<ImageView>getView(R.id.houserentshow_fwpz_item_img))
                .build());
    }
    }
}
